﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services.Protocols;
using System.Web.Services;
using System.Web.Script.Services;
using System.Web.Security;
using Nivdal.AuxCode;

namespace Nivdal
{
    /// <summary>
    /// Summary description for WebServices
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class WebServices : System.Web.Services.WebService
    {

        [WebMethod]
        public bool CheckEmail(string email)
        {
            try
            {
                string usr = Membership.GetUserNameByEmail(email);
                return (usr == null);
            }
            catch
            {
                return false;
            }

        }

        [WebMethod]
        public string HelloWorld()
        {
            //OnlineUser ou = (OnlineUser)Session["User"];
            //string UserId = ou.UserId;
            return "Hello World";
        }

        [WebMethod]
        public bool IsDataBaseup()
        {
             GetNivdalData.GetNivdalData GND = new GetNivdalData.GetNivdalData();
             return GND.ReadNivdalBoolData("Nivdal_IsDataBabseUp");
        }

        
        [WebMethod]
        public void SetTipsPosition(int Top, int Left, string UserId)
        {
            GetNivdalData.GetNivdalData GND = new GetNivdalData.GetNivdalData();
            GND.ExecNivdalSQL("UserId", "Top", "Left", "Nivdal_SetUserTopLeftTipsPosition", UserId, Top, Left);
        }
    }
}
